package dominion.model.actions.base;

import java.util.List;

import dominion.model.Card;
import dominion.model.GameBoard;
import dominion.model.Player;
import dominion.model.actions.Action;
import dominion.utils.Constants;

public class Moneylender extends Action {

	public Moneylender() {
		cost = 4;
	}

	@Override
	public Card clone() {
		return new Moneylender();
	}

	@Override
	public String toString() {
		return "Moneylender";
	}

	@Override
	public String getDescription() {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDescription());
		sb.append("Trash a copper from your hand.\n");
		sb.append("+$3\n");
		return sb.toString();
	}

	@Override
	public void doAction(Player player, GameBoard board, List<Player> players) {
		player.changeAction(-1);
		playedCard(player);

		if (!player.getHand().contains("copper"))
		{
			Constants.printer.print("No copper in hand to trash.");
		}
		else
		{
			Constants.printer.print("Trashing a copper...");
			Card card = player.getHand().drawCard("copper");
			board.addToTrash(card);
			player.changeMoney(3);
		}
	}
}
